﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Services.Protocols;

namespace com.huawei.esdk.tp.oa.Utils
{
    public partial class ExceptionUtils
    {
        public static int processSoapException(SoapHeaderException e)
        {
            String faultCodeString = e.Code.Name;

            if (faultCodeString.Contains(Convert.ToString(NativeConstant.SESSION_NOT_CORRECT)))
            {
                return NativeConstant.SESSION_NOT_CORRECT;
            }
            else if (faultCodeString.Contains(Convert.ToString(NativeConstant.AUTHORIZE_ERRORCODE)))
            {
                return NativeConstant.AUTHORIZE_ERRORCODE;
            }
            else if (faultCodeString.Contains(Convert.ToString(NativeConstant.SYSTEM_ERRORCODE)))
            {
                return NativeConstant.SYSTEM_ERRORCODE;
            }
            else if (faultCodeString.Contains(Convert.ToString(NativeConstant.ERROR_CODE_SDK_AUTHORIZE_FAILURE)))
            {
                return NativeConstant.ERROR_CODE_SDK_AUTHORIZE_FAILURE;
            }
            else
            {
                return NativeConstant.NATIVE_ERRORCODE;
            }
        }
    }
}
